home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Agent Central Host Computer
/
Agent - Central Host Computer.iso
/
_SETUP.1
/
vcuraccDetail.sql
< prev
next >
Wrap
Text File
|
2000-05-12
|
1KB
|
29 lines
/*
For a range of det_seq_num determined by vcurstaterange, this view "flattens" the curacc table, grouping by bill and coin type, using the decode function; then sums the types.
*/
CREATE OR REPLACE VIEW VCURACCDETAIL AS
SELECT vcurstaterange.conversion_num,
vcurstaterange.open_count,
vcurstaterange.close_count,
vcurstaterange.cashbox_glid,
SUM(CURACC.currency_val) probedcash,
SUM(DECODE(currency_type, 204, currency_val, 0)) cents_$,
SUM(DECODE(currency_type, 203, currency_val, 0)) nickels_$,
SUM(DECODE(currency_type, 202, currency_val, 0)) dimes_$,
SUM(DECODE(currency_type, 201, currency_val, 0)) quarters_$,
SUM(DECODE(currency_type, 205, currency_val, 0)) halfs_$,
SUM(DECODE(currency_type, 206, currency_val, 0)) sbas_$,
SUM(DECODE(currency_type, 250, 1, 0)) sm_tokens,
SUM(DECODE(currency_type, 251, 1, 0)) lg_tokens,
SUM(DECODE(currency_type, 301, currency_val, 0)) ones_$,
SUM(DECODE(currency_type, 302, currency_val, 0)) fives_$,
SUM(DECODE(currency_type, 303, currency_val, 0)) tens_$,
SUM(DECODE(currency_type, 304, currency_val, 0)) twenties_$
FROM vcurstaterange, CURACC
WHERE CURACC.det_seq_num BETWEEN open_count AND close_count
GROUP BY conversion_num,
open_count,
close_count,
vcurstaterange.cashbox_glid;